const baseURL= 'https://api.jiandaoyun.com/api/v5'
const httpInterceptor= {
	invoke(options){
		// 拼接地址
		if(!options.url.startsWith('http')){
			options.url = baseURL + options.url
		}
		console.log('请求拦截器1',options)
		options.timeout = 100000
		// options.header = {}
		// options.header.Authorization ="Bearer VoXUqkw1p5r7xV4GAIV9CztTQNyHsYHi"
		options.header = { Authorization:"Bearer YU29cl6ljo0olBVxcKEEvHtykH0kSbrA" }
		// console.log(options)
		return options
	}
}
uni.addInterceptor('request',httpInterceptor)
uni.addInterceptor('uploadFile',httpInterceptor)

export const http = (options)=>{
	return new Promise((resolve,reject)=>{
		uni.request({
			...options,
			// 请求成功时的回调
			success(res){
				resolve(res)
			}
		})
	})
}